package cn.itcast.day03.demo01;

import java.util.Enumeration;

public class Demo01Main {
    public static void main(String[] args) {
        //首先出创建一个笔记本电脑
        Computer computer = new Computer();
        computer.powerOn();
        //首先准备一个鼠标，供电脑使用
//    Mouse mouse = new Mouse();
        //首先向上转型
        USB usbMouse = new Mouse();  //多态写法(左父右子)
        //参数是USB类型，我正好传递进去的就是USB鼠标
        computer.useDevice(usbMouse);

        //创建一个USB键盘
        Keyboard keyboard = new Keyboard();   //没有使用多态写法
       //方法参数是USB类型，传递进去的是实现类对象
        computer.useDevice(keyboard);
        computer.useDevice(new Keyboard());
        computer.powerOff();
        System.out.println("============================");
        method(10); //double --> double
        method(10.0);  //int  --> double
        int a = 30;
        method(a); //   int -->  double
        System.out.println("==============================");
    }
    public static void method(double num){
        System.out.println(num);
    }
}
